#!/bin/bash

echo "安装nvidia显卡驱动"
echo "注意nvidia垂直同步有问题，你需要在nvidia-settings里面设置"
echo "  nvidia-settings-> X Server -> Advanced -> Force Full"
echo 
read -p "回车继续"

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
apt install nvidia-driver-465 xserver-xorg-video-nvidia-465
ubuntu-drivers autoinstall
prime-select on-demand
update-initramfs -u

